home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / predator.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  4.0 KB  |  126 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; Predator effect
  4. ; Copyright (c) 1997 Adrian Likins
  5. ; aklikins@eos.ncsu.ed
  6. ;
  7. ;  The idea here is too make the image/selection look sort of like 
  8. ;  the view the predator had in the movies. ie, kind of a thermogram
  9. ;  type of thing. Works best on colorful rgb images.
  10. ;
  11. ; This program is free software; you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 2 of the License, or
  14. ; (at your option) any later version.
  15. ; This program is distributed in the hope that it will be useful,
  16. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. ; GNU General Public License for more details.
  19. ; You should have received a copy of the GNU General Public License
  20. ; along with this program; if not, write to the Free Software
  21. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23.  
  24. (define (script-fu-predator image
  25.                 drawable
  26.                 edge-amount
  27.                 pixelize
  28.                 pixel-size
  29.                 keep-selection
  30.                 separate-layer)
  31.   (let* (
  32.      (type (car (gimp-drawable-type-with-alpha drawable)))
  33.      (image-width (car (gimp-image-width image)))
  34.      (image-height (car (gimp-image-height image)))
  35.      (active-selection)
  36.      (from-selection)
  37.      (selection-bounds)
  38.      (select-offset-x)
  39.      (select-offset-y)
  40.      (select-width)
  41.      (select-height)
  42.      (effect-layer)
  43.      (active-layer))
  44.     
  45.     (gimp-image-undo-group-start image)
  46.     (gimp-layer-add-alpha drawable)
  47.     
  48.     (if (= (car (gimp-selection-is-empty image)) TRUE)
  49.     (begin
  50.       (gimp-selection-layer-alpha drawable)
  51.       (set! active-selection (car (gimp-selection-save image)))
  52.       (set! from-selection FALSE))
  53.     (begin
  54.       
  55.       (set! from-selection TRUE)
  56.       (set! active-selection (car (gimp-selection-save image)))))
  57.     
  58.     (set! selection-bounds (gimp-selection-bounds image))
  59.     (set! select-offset-x (cadr selection-bounds))
  60.     (set! select-offset-y (caddr selection-bounds))
  61.     (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
  62.     (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
  63.     
  64.     (if (= separate-layer TRUE)
  65.     (begin
  66.       (set! effect-layer (car (gimp-layer-new image
  67.                         select-width
  68.                         select-height
  69.                         type
  70.                         "glow layer"
  71.                         100
  72.                         NORMAL-MODE)))
  73.     
  74.       (gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
  75.       (gimp-image-add-layer image effect-layer -1)
  76.       (gimp-selection-none image)
  77.       (gimp-edit-clear effect-layer)
  78.     
  79.       (gimp-selection-load active-selection)
  80.       (gimp-edit-copy drawable)
  81.       (let ((floating-sel (car (gimp-edit-paste effect-layer FALSE))))
  82.         (gimp-floating-sel-anchor floating-sel)
  83.         )
  84.       (gimp-image-set-active-layer image effect-layer ))
  85.       (set! effect-layer drawable)
  86.     )
  87.     (set! active-layer effect-layer)
  88.  
  89.     ; all the fun stuff goes here
  90.     (if (= pixelize TRUE)
  91.     (plug-in-pixelize 1 image active-layer pixel-size))
  92.     (plug-in-max-rgb 1 image active-layer 0)
  93.     (plug-in-edge 1 image active-layer edge-amount 1 0)
  94.     
  95.     ; clean up the selection copy
  96.     (gimp-selection-load active-selection)
  97.     
  98.     (if (= keep-selection FALSE)
  99.     (gimp-selection-none image))
  100.     
  101.     (gimp-image-set-active-layer image drawable)
  102.     (gimp-image-remove-channel image active-selection)
  103.     (gimp-image-undo-group-end image)
  104.     (gimp-displays-flush)))
  105.  
  106. (script-fu-register "script-fu-predator"
  107.             _"_Predator..."
  108.             "Looks like images from the movie Predator"
  109.             "Adrian Likins <adrian@gimp.org>"
  110.             "Adrian Likins"
  111.             "10/12/97"
  112.             "RGB*"
  113.             SF-IMAGE       "Image"          0
  114.             SF-DRAWABLE    "Drawable"       0
  115.             SF-ADJUSTMENT _"Edge amount"    '(2 0 24 1 1 0 0)
  116.             SF-TOGGLE     _"Pixelize"       TRUE
  117.             SF-ADJUSTMENT _"Pixel amount"   '(3 1 16 1 1 0 0)
  118.             SF-TOGGLE     _"Keep selection" TRUE
  119.             SF-TOGGLE     _"Separate layer" TRUE)
  120.  
  121. (script-fu-menu-register "script-fu-predator"
  122.              _"<Image>/Script-Fu/Alchemy")
  123.